package com.wyd.facade;

import com.wyd.facade.receiver.*;

/**
 * 外观模式类
 *
 * 组合了多个子系统，并对客户暴露简单易用的接口
 *
 * @author Yudi Wang
 * @date 2022/1/30 11:33
 */
public class HomeController {
    private Door door;
    private Light light;
    private Window window;

    public HomeController(Door door, Light light, Window window) {
        this.door = door;
        this.light = light;
        this.window = window;
    }

    public void off(){
        door.close();
        window.switchOff();
        light.off();
    }

    public void on(){
        door.open();
        window.switchOn();
        light.on();
    }
}
